package com.entity;

import java.io.Serializable;
import javax.persistence.*;



import com.alibaba.fastjson.annotation.JSONField;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;


/**
 * The persistent class for the "order" database table.
 * 
 */
@Entity
@Table(name="\"order\"")
@NamedQuery(name="Order.findAll", query="SELECT o FROM Order o")
public class Order implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(name="ORDER_ORID_GENERATOR", sequenceName="SEQ",initialValue=1,allocationSize=1)
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="ORDER_ORID_GENERATOR")
	@Column(name="OR_ID")
	private long orId;

	@Temporal(TemporalType.DATE)
	@Column(name="OR_FINISH")
	@JSONField(format="yyyy-MM-dd")
	private Date orFinish;

	@Column(name="OR_MONEY")
	private BigDecimal orMoney;

	
	@Temporal(TemporalType.DATE)
	@Column(name="OR_START")
	@JSONField(format="yyyy-MM-dd")
	private Date orStart;

	@Column(name="OR_STATE")
	private BigDecimal orState;

	@Column(name="OR_TITLE")
	private String orTitle;
	
	@Column(name="OR_OR")
	private BigDecimal orOr;
	
	@Temporal(TemporalType.DATE)
	@Column(name="OR_SIGNERTIME")
	@JSONField(format="yyyy-MM-dd")
	private Date orSignertime;
	
	
	
	public Date getOrSignertime() {
		return orSignertime;
	}

	public void setOrSignertime(Date orSignertime) {
		this.orSignertime = orSignertime;
	}
	
	@Column(name="OR_OWNER")
	private String orOwner;

	public String getOrOwner() {
		return orOwner;
	}

	public void setOrOwner(String orOwner) {
		this.orOwner = orOwner;
	}

	@Transient
	private BigDecimal returnmoney;
		

	public BigDecimal getReturnmoney() {
		return returnmoney;
	}

	public void setReturnmoney(BigDecimal returnmoney) {
		this.returnmoney = returnmoney;
	}
	
	@Transient
	private BigDecimal billmoney;
	

	public BigDecimal getBillmoney() {
		return billmoney;
	}

	public void setBillmoney(BigDecimal billmoney) {
		this.billmoney = billmoney;
	}
	
	@Transient
	private String state;
	

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	//bi-directional many-to-one association to Deliver
	@OneToMany(cascade={CascadeType.REMOVE},mappedBy="order")
	
	private List<Deliver> delivers;

	//bi-directional many-to-one association to Odo
	@OneToMany(cascade={CascadeType.REMOVE},mappedBy="order")
	
	private List<Odo> odos;

	//bi-directional many-to-one association to Orderdetail
	@OneToMany(cascade={CascadeType.REMOVE},mappedBy="order")
	
	private List<Orderdetail> orderdetails;

	//bi-directional many-to-one association to Payplan
	@OneToMany(cascade={CascadeType.REMOVE},mappedBy="order")
	
	private List<Payplan> payplans;

	//bi-directional many-to-one association to Repro
	@OneToMany(cascade={CascadeType.REMOVE},mappedBy="order")
	
	private List<Repro> repros;

	//bi-directional many-to-one association to Customer
	@ManyToOne
	@JoinColumn(name="CUSNO")
	private Customer customer;

	//bi-directional many-to-many association to Product
	@ManyToMany
	@JSONField(serialize=false)
	@JoinTable(
		name="RELATIONSHIP_71"
		, joinColumns={
			@JoinColumn(name="OR_ID")
			}
		, inverseJoinColumns={
			@JoinColumn(name="ID")
			}
		)
	private List<Product> products;

	public Order() {
	}

	public long getOrId() {
		return this.orId;
	}

	public void setOrId(long orId) {
		this.orId = orId;
	}

	public Date getOrFinish() {
		return this.orFinish;
	}

	public void setOrFinish(Date orFinish) {
		this.orFinish = orFinish;
	}

	public BigDecimal getOrMoney() {
		return this.orMoney;
	}

	public void setOrMoney(BigDecimal orMoney) {
		this.orMoney = orMoney;
	}

	public Date getOrStart() {
		return this.orStart;
	}

	public void setOrStart(Date orStart) {
		this.orStart = orStart;
	}

	public BigDecimal getOrState() {
		return this.orState;
	}

	public void setOrState(BigDecimal orState) {
		this.orState = orState;
	}

	public String getOrTitle() {
		return this.orTitle;
	}

	public void setOrTitle(String orTitle) {
		this.orTitle = orTitle;
	}

	public List<Deliver> getDelivers() {
		return this.delivers;
	}

	public void setDelivers(List<Deliver> delivers) {
		this.delivers = delivers;
	}

	public Deliver addDeliver(Deliver deliver) {
		getDelivers().add(deliver);
		deliver.setOrder(this);

		return deliver;
	}

	public Deliver removeDeliver(Deliver deliver) {
		getDelivers().remove(deliver);
		deliver.setOrder(null);

		return deliver;
	}

	public List<Odo> getOdos() {
		return this.odos;
	}

	public void setOdos(List<Odo> odos) {
		this.odos = odos;
	}

	public Odo addOdo(Odo odo) {
		getOdos().add(odo);
		odo.setOrder(this);

		return odo;
	}

	public Odo removeOdo(Odo odo) {
		getOdos().remove(odo);
		odo.setOrder(null);

		return odo;
	}

	public List<Orderdetail> getOrderdetails() {
		return this.orderdetails;
	}

	public void setOrderdetails(List<Orderdetail> orderdetails) {
		this.orderdetails = orderdetails;
	}

	public Orderdetail addOrderdetail(Orderdetail orderdetail) {
		getOrderdetails().add(orderdetail);
		orderdetail.setOrder(this);

		return orderdetail;
	}

	public Orderdetail removeOrderdetail(Orderdetail orderdetail) {
		getOrderdetails().remove(orderdetail);
		orderdetail.setOrder(null);

		return orderdetail;
	}

	public List<Payplan> getPayplans() {
		return this.payplans;
	}

	public void setPayplans(List<Payplan> payplans) {
		this.payplans = payplans;
	}

	public Payplan addPayplan(Payplan payplan) {
		getPayplans().add(payplan);
		payplan.setOrder(this);

		return payplan;
	}

	public Payplan removePayplan(Payplan payplan) {
		getPayplans().remove(payplan);
		payplan.setOrder(null);

		return payplan;
	}

	public List<Repro> getRepros() {
		return this.repros;
	}

	public void setRepros(List<Repro> repros) {
		this.repros = repros;
	}

	public Repro addRepro(Repro repro) {
		getRepros().add(repro);
		repro.setOrder(this);

		return repro;
	}

	public Repro removeRepro(Repro repro) {
		getRepros().remove(repro);
		repro.setOrder(null);

		return repro;
	}

	public Customer getCustomer() {
		return this.customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	public List<Product> getProducts() {
		return this.products;
	}

	public void setProducts(List<Product> products) {
		this.products = products;
	}

	public BigDecimal getOrOr() {
		return orOr;
	}

	public void setOrOr(BigDecimal orOr) {
		this.orOr = orOr;
	}

	@Override
	public String toString() {
		return "Order [orId=" + orId + ", orFinish=" + orFinish + ", orMoney=" + orMoney + ", orStart=" + orStart
				+ ", orState=" + orState + ", orTitle=" + orTitle + ", orOr=" + orOr + ", orSignertime=" + orSignertime
				+ ", orOwner=" + orOwner + ", returnmoney=" + returnmoney + ", billmoney=" + billmoney + ", state="
				+ state + ", delivers=" + delivers + ", odos=" + odos + ", orderdetails=" + orderdetails + ", payplans="
				+ payplans + ", repros=" + repros + ", customer=" + customer + ", products=" + products + "]";
	}

	

}